<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="btn">hello</button>
    <script>
      const btn = document.getElementById("btn");
      btn.addEventListener("click", (e) => {
        if (e.isTrusted) {
          // ...
        } else {
          // ...
        }
      });

      const clickE = new Event("click");
      // 手动触发addEventListener事件处理函数
      btn.dispatchEvent(clickE);
    </script>
  </body>
</html>
